#define _CRT_SECURE_NO_WARNINGS 1
#include<iostream>
using namespace std;


int month[] = { -1,31,29,31,30,31,30,31,31,30,31,30,31 };

int main()
{
	int s1, s2; cin >> s1 >> s2;
	int count = 0;
	for(int i = 1; i <= 12; i++)
		for (int j = 1; j <= month[i]; j++)
		{
			int k = (j % 10) * 1000 + (j / 10) * 100 + (i % 10) * 10 + i / 10;
			int m = k * 10000 + i * 100 + j;
			if (m >= s1 && m <= s2) count++;
		}
	cout << count << endl;
	return 0;
}